package com.ag.promanagement.dto;

import com.ag.presentation.backEndBeans.UserTypeView;

import com.ag.promanagement.UserType;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class UserTypeDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String type;
    private String id;
    private boolean rowSelected = false;
    private UserTypeView userTypeView;
    private UserType userType;

    public UserType getUserType() {
        return userType;
    }

    public String listener_update(ActionEvent e) {
        try {
            userTypeView.action_modifyWitDTO(((id == null) || id.equals(""))
                ? null : new Long(id),
                ((type == null) || type.equals("")) ? null : new String(type));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        id = userType.getId().toString();
        type = (userType.getType() != null) ? userType.getType().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        id = userType.getId().toString();
        type = (userType.getType() != null) ? userType.getType().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setUserType(UserType userType) {
        this.userType = userType;
    }

    public UserTypeView getUserTypeView() {
        return userTypeView;
    }

    public void setUserTypeView(UserTypeView userTypeView) {
        this.userTypeView = userTypeView;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
